<!--查询所有课题信息-->
<template>
  <div class="wrapper-container">
    <div class="search-container">
        <div class="search-container-item right20">
            <div class="item-name">课题活动：</div>
            <el-select v-model="dataForm.subActivityId" placeholder="请选择" class="inputWidth" size="mini">
                <el-option v-for="item in xi" :key="item.id" :label="item.deptName" :value="item.id"></el-option>
            </el-select>
        </div>
        <div class="search-container-item right20">
            <div class="item-name">系：</div>
            <el-select v-model="dataForm.xi" placeholder="请选择" class="inputWidth" size="mini">
                <el-option v-for="item in xi" :key="item.id" :label="item.deptName" :value="item.id"></el-option>
            </el-select>
        </div>
        <div class="search-container-item right20">
            <div class="item-name">教研室：</div>
            <el-select v-model="dataForm.jys" placeholder="请选择" class="inputWidth" size="mini">
                <el-option v-for="item in xi" :key="item.id" :label="item.deptName" :value="item.id"></el-option>
            </el-select>
        </div>
        <div class="search-button color-primary" @click="initList">
            <img src="../../assets/assessment/icon-search.png" alt="" />
            <span>查询</span>
        </div>
    </div>
    <div class="table-container table-css">
        <el-table :data="tableData" border style="width: 100%" class="table-data" :header-cell-style="{background:'#edf2f9','border-color': '#c7d7eb'}">
            <el-table-column prop="roleName" label="序号" align="center" min-width="80">
              <template slot-scope="scope">
                  {{scope.$index + 1 + (parseInt(dataForm.pageNo) - 1) * 50  }}
                </template>
            </el-table-column>
            <el-table-column prop="fillSubjectName" label="课题名称" align="center" min-width="200"> </el-table-column>
            <el-table-column prop="subjectId" label="课题编号" align="center" min-width="200"> </el-table-column>
            <el-table-column prop="subCategoryName" label="类别" align="center" min-width="120"> </el-table-column>
            <el-table-column prop="subjectLeaderName" label="课题负责人" align="center" min-width="120"> </el-table-column>
            <el-table-column prop="currentStageName" label="当前所属阶段" align="center" min-width="150"> </el-table-column>
            <el-table-column prop="buildDate" label="确定立项时间" align="center" min-width="180"> </el-table-column>
            <el-table-column prop="checkDate" label="验收时间" align="center" min-width="180"> </el-table-column>
            <el-table-column prop="buildTime" label="建设周期" align="center" min-width="200"> </el-table-column>
            <el-table-column prop="remark" label="备注" align="center" min-width="300"> </el-table-column>
        </el-table>
        <h1 class="total-notice">当前共找到{{total}}条记录，当前显示{{(dataForm.pageNo-1)*50 == 0?1:(dataForm.pageNo-1)*50}}-{{total>50?dataForm.pageNo*50:total}}条</h1>
        <div class="pagination-block">
            <el-pagination v-if="total>50" prev-text="上一页" next-text="下一页" @current-change="currentPage"
            :page-size="50" layout="prev, pager, next, jumper" :total="total"></el-pagination>
        </div>
    </div>
  </div>
</template>

<script>
import {allKTInfo} from "@/api/teachingTopic";

export default {
  data() {
    return {
      total:1,
      dataForm:{
        jys:'',//教研室
        subActivityId:'',//课题活动id
        xi:'',
        pageNo:1,
        pageSize:50
      },
      xi:[],
      jys:[],
      tableData: [{}],
    };
  },
  mounted(){
    this.initList();
     //系列表
    this.commonApi.getXIOption().then(res=>{
      this.xi = [{deptName:'全部'},...res.data]
    })
    //获取教研室
    this.commonApi.getJYSOption().then(res=>{
      this.jys = [{deptName:'全部'},...res.data]
    })
  },
  methods: {
    //初始化表格
    async initList(){
      let res = await allKTInfo(this.dataForm);
      if(res.code == 200){
        this.tableData = res.data.records;
        this.total = res.data.total
      }
    },
    currentPage(e){
      this.dataForm.pageNo = e;
      this.initList()
    },
  },
};
</script>
<style lang="less" scoped>
.table-css {
  margin-top: 30px;
 /deep/ .el-table td,
  .el-table th.is-leaf,
  .el-table--border,
  .el-table--group {
    border-color: #c7d7eb;
  }

  /deep/.el-table__header tr,
  .el-table__header th {
    padding: 0;
    height: 76px;
    background-color: #edf2f9;
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: bold;
    line-height: 20px;
    color: #004ca7;
  }

  /deep/.el-table__body tr,
  .el-table__body td {
    padding: 0;
    height: 86px;
  }
 /deep/ .el-table__footer-wrapper td {
    padding: 0;
    height: 86px;
  }
  /deep/.el-table thead.is-group th.el-table__cell{
    border-color: #c7d7eb;
  }
 /deep/ .el-table--border th, .el-table__fixed-right-patch{
    border-color: #c7d7eb;
  }
}
</style>

<style lang="less" scoped>
@import "../../styles/commonCss.less";
.right20{margin-right: 20px;}
.color-primary{width: 70px;}
.search-container {
  justify-content: flex-start !important;
}
.inputWidth{width: 122px;}
</style>
